<?php
/**
* openDocument library kit
*
* @link http://webappkit.net
* @package pathnodes
* @subpackage od
* @author J.Ducastel <nospam0@ducastel.name>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
* Wrapper for opendocument xml fragments.
* @author J.Ducastel <nospam0@ducastel.name>
*/
class odXmlFragment extends xpathDomNode {
/*--------------------------------------------------------------------
CONSTRUCTOR
--------------------------------------------------------------------*/
    /**
    * constructor alias
    * @access public
    */
    function odXmlFragment(&$dom) {
        $this->__construct($dom);
    }/**/
    
    /**
    * "real" constructor
    * @access public
    */
    function __construct(&$dom) {
        parent::__construct($dom);
        $this->id=uniqid('od_fragment_');
    }/**/
/*--------------------------------------------------------------------
PUBLIC STATIC METHODS
--------------------------------------------------------------------*/
    /**
    * 
    * @static
    * @param
    * @return 
    * /
    function () {
        
    }/**/
/*--------------------------------------------------------------------
PUBLIC INSTANCE METHODS
--------------------------------------------------------------------*/
    /**
    * sets container reference
    * @param odContainer_zip|odContainer_folder|odContainer_xml $container
    * @access public
    * @return bool
    */
    function setContainer(&$container) {
        $this->container=&$container;
        return true;
    }/**/

    /**
    * get container's reference
    * @access public
    * @return odContainer_zip
    */
    function getContainer() {
        return $this->container;
    }/**/
    
    /**
    * get unique id
    * @access public
    * @return string
    */
    function getId() {
        return $this->id;
    }/**/
/*--------------------------------------------------------------------
VARS / MEMBERS
--------------------------------------------------------------------*/
    /**
     * @var string unique id
     */
    var $id;

    /**
    * @var odContainer_zip|odContainer_folder|odContainer_xml container reference
    */
    var $container;
    
    /**
     * @var odFileNode owner open document
     */
     var $doc;
    
/*--------------------------------------------------------------------
PRIVATE / PROTECTED METHODS
--------------------------------------------------------------------*/
    /**
    * notify update to observers
    * @access protected
    * @return bool
    */
    function _updated() {
        // notifying container
        $this->container->childUpdated($this);
    }/**/
    
    /**
    * will be called by __construct()
    * @link http://books.evc-cit.info/odbook/ch01.html#ooo-namespaces-section
    * @access protected
    * @return bool
    * @todo complete the list
    */
    function _setNamespaces() {
        if (!$this->registerNamespace('office','urn:oasis:names:tc:opendocument:xmlns:office:1.0')
        or !$this->registerNamespace('meta','urn:oasis:names:tc:opendocument:xmlns:meta:1.0')
        or !$this->registerNamespace('config','urn:oasis:names:tc:opendocument:xmlns:config:1.0')
        or !$this->registerNamespace('text','urn:oasis:names:tc:opendocument:xmlns:text:1.0')
        or !$this->registerNamespace('table','urn:oasis:names:tc:opendocument:xmlns:table:1.0')
        or !$this->registerNamespace('drawing','urn:oasis:names:tc:opendocument:xmlns:drawing:1.0')
        or !$this->registerNamespace('presentation','urn:oasis:names:tc:opendocument:xmlns:presentation:1.0')
        //or !$this->registerNamespace('dr3d','urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0')
        //or !$this->registerNamespace('anim','urn:oasis:names:tc:opendocument:xmlns:animation:1.0')
        or !$this->registerNamespace('chart','urn:oasis:names:tc:opendocument:xmlns:chart:1.0')
        or !$this->registerNamespace('form','urn:oasis:names:tc:opendocument:xmlns:form:1.0')
        or !$this->registerNamespace('script','urn:oasis:names:tc:opendocument:xmlns:script:1.0')
        or !$this->registerNamespace('style','urn:oasis:names:tc:opendocument:xmlns:style:1.0')
        //or !$this->registerNamespace('number','urn:oasis:names:tc:opendocument:xmlns:data style:1.0')
        or !$this->registerNamespace('manifest','urn:oasis:names:tc:opendocument:xmlns:manifest:1.0')) {
            trigger_error("failed to set namespaces", E_USER_WARNING);
            return false;
        }
        //print_r($this);
        return true;
    }/**/
}
?>